/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package info.peigen.hotpot.manage.core.repository.entity;

import com.gitee.peigenlpy.actable.annotation.Column;
import com.gitee.peigenlpy.actable.annotation.Table;
import com.gitee.peigenlpy.actable.annotation.Unique;
import com.gitee.peigenlpy.actable.constants.MySqlCharsetConstant;
import com.gitee.peigenlpy.actable.constants.MySqlEngineConstant;
import com.gitee.peigenlpy.actable.constants.MySqlTypeConstant;
import com.gitee.peigenlpy.sansheng.core.annotation.ColumnField;
import info.peigen.hotpot.common.core.enums.YesOrNo;
import info.peigen.hotpot.component.data.repository.beetlsql.entity.AbstractCreateTimeEntity;
import info.peigen.hotpot.manage.core.enums.ResourceCategory;
import info.peigen.hotpot.manage.core.enums.ResourceMenuType;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

/**
 * <b>(ResourceEntity)</b>
 * 资源表，包含模块、菜单、按钮
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024/6/11
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
@Table(name = "resource", comment = "资源", charset = MySqlCharsetConstant.UTF8MB4, engine = MySqlEngineConstant.InnoDB)
@org.beetl.sql.annotation.entity.Table(name = "resource")
public class ResourceEntity extends AbstractCreateTimeEntity {
    @ColumnField(key = true)
    @Unique(value = "resourceId", columns = "resource_id")
    @Column(name = "resource_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "资源Id")
    @org.beetl.sql.annotation.entity.Column("resource_id")
    String           resourceId;
    @Column(name = "parent_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "父Id")
    @org.beetl.sql.annotation.entity.Column("parent_id")
    String           parentId;
    @Column(name = "title", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "标题")
    @org.beetl.sql.annotation.entity.Column("title")
    String           title;
    @ColumnField(testUnique = "name")
    @Column(name = "name", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "别名")
    @org.beetl.sql.annotation.entity.Column("name")
    String           name;
    @Column(name = "code", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "编码")
    @org.beetl.sql.annotation.entity.Column("code")
    String           code;
    @Column(name = "category", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "分类")
    @org.beetl.sql.annotation.entity.Column("category")
    ResourceCategory category;
    @Column(name = "module", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "模块")
    @org.beetl.sql.annotation.entity.Column("module")
    String           module;
    @Column(name = "menu_type", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "菜单类型")
    @org.beetl.sql.annotation.entity.Column("menu_type")
    ResourceMenuType menuType;
    @Column(name = "path", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "路径")
    @org.beetl.sql.annotation.entity.Column("path")
    String           path;
    @Column(name = "component", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "组件")
    @org.beetl.sql.annotation.entity.Column("name")
    String           component;
    @Column(name = "icon", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "图标")
    @org.beetl.sql.annotation.entity.Column("icon")
    String           icon;
    @Column(name = "color", type = MySqlTypeConstant.VARCHAR, length = 30, comment = "颜色")
    @org.beetl.sql.annotation.entity.Column("color")
    String           color;
    @Column(name = "visible", type = MySqlTypeConstant.VARCHAR, length = 5, isNull = false, comment = "是否可见")
    @org.beetl.sql.annotation.entity.Column("visible")
    YesOrNo          visible;
    @Column(name = "sort", type = MySqlTypeConstant.INT, comment = "排序序号")
    @org.beetl.sql.annotation.entity.Column("sort")
    Integer          sort;
    @Column(name = "ext", type = MySqlTypeConstant.JSON, length = 1000, comment = "扩展信息")
    @org.beetl.sql.annotation.entity.Column("ext")
    String           ext;
}
